from llama_index.core import Settings
from llama_index.core.tools import FunctionTool
from llama_index.core.agent import ReActAgent

from config.llm import deepseek_llm


#定义乘积工具函数
def multiply(a: int, b: int) -> int:
    """两数相乘."""
    return a * b

multiply_tool = FunctionTool.from_defaults(fn=multiply)

#设置全局LLM
Settings.llm = deepseek_llm()

#创建ReActAgent 代理
agent = ReActAgent.from_tools(
    #工具列表
    tool_list=[multiply_tool],
    #LLM
    llm=Settings.llm,
    #工具选择器
    verbose=True
)

response = agent.chat("请计算10乘以20的乘积")
print(response)